package com.bl.student.common.enums.pay;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * Created by yujingyi on 2017/9/20.
 */
@Getter
@AllArgsConstructor
public enum TradeStatus {

    DOING(1, "进行中"),
    SUCCESS(2, "成功"),
    FAILED(3, "失败"),
    FINISHED(4, "结束"),
    CLOSED(5, "关闭");

    private int status;
    private String name;

    private static Map<Integer, TradeStatus> enumMap = Maps.newHashMap();
    static {
        for (TradeStatus item : values()) {
            enumMap.put(item.status, item);
        }
    }

    public static TradeStatus fromValue(String status) {
        TradeStatus item = enumMap.get(status);
        return item;
    }

}
